<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>消息阅读回执详情</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
	<script src="__PUBLIC__/News/js/jweixin-1.1.0.js"></script>
	<link rel="stylesheet" href="__PUBLIC__/News/css/weui.min.css"/>
    <link rel="stylesheet" href="__PUBLIC__/News/css/example.css"/>
	<script src="__PUBLIC__/News/js/jquery.js"></script>
	<style>
		#person{
			display: block;
			float: left;
			margin: 6px 6px;
			width:38px;
			text-align:center;
			font-size:3vw;
		}
	</style>
	<script>
		wx.config({
			//关闭调试模式
		    debug: false,
		    appId: '<?php echo $signPackage["appId"];?>',
		    timestamp: <?php echo $signPackage["timestamp"];?>,
		    nonceStr: '<?php echo $signPackage["nonceStr"];?>',
		    signature: '<?php echo $signPackage["signature"];?>',
		    jsApiList: [
		      // 所有要调用的 API 都要加到这个列表中
		      'closeWindow','hideOptionMenu','openEnterpriseChat',
		    ]
	    });
	    //屏蔽菜单
	    wx.ready(function(){
 			//屏蔽菜单
 			wx.hideOptionMenu();
		});
		function close_window(){
			wx.closeWindow();
		}
		//jssdk发起临时会话 
//  		function chat(userid){
//  			wx.ready(function () {
//			    //调用jssdk方法开始
//			    wx.openEnterpriseChat({
//			    userIds: userid,
//			    groupName: '',
//			    success: function(res) {
//			        // 回调
//			    },
//			    fail: function(res) {
//			        alert('调用失败!');
//			            if(res.errMsg.indexOf('function not exist') > -1){
//			                alert('版本过低请升级')
//			            }
//			        }
//			    });
//			    //调用jssdk方法结束
//	 		});
//  		}
	</script>
	<script>
		$(function(){
			//关闭事件监听
			$('#msg_close').bind('click',function(){
				history.back();
			});
			$('#del_single').bind('click',function(){
				$('#dialog1').show();
			});
			$('#del_no').bind('click',function(){
				$('#dialog1').hide();
			});
			$('#del_yes').bind('click',function(){
				//执行删除操作
				var url = "__CONTROLLER__/del_single/state/{$corpid}/newsid/{$news_id}";
				location.href = url;
			});
			//未读详情获取 unread_list_avatar1
			$('.unread_list_avatar1').bind('click',function(){
				var src = $(this).attr('src');
				src = getBigImage(src);
				var name = $(this).attr('uname');
				var mobile = $(this).attr('tel');
				var userid = $(this).attr('userid');
				var readtime = $(this).attr('readtime');
				if($(this).attr('readfortime')==''){
					var readfortime = '无数据'
				}else{
					var readfortime = $(this).attr('readfortime')+'秒';
				}
				
				$('.tel_a').attr('href',"tel:"+mobile);
				$('.weui-dialog__bd #photo').attr('src',src);
				$('.weui-dialog__bd span:eq(0)').html('姓名:'+name);
				$('.weui-dialog__bd span:eq(1)').html(readfortime);
				$('.weui-dialog__bd span:eq(2)').html(readtime);
				//$('.open_chat').attr('userid',userid);
				$('.unread_div1').show();
			});
			
			//点击头像获取成员基本信息
			$('.unread_list_avatar').bind('click',function(){
				var src = $(this).attr('src');
				src = getBigImage(src);
				var name = $(this).attr('uname');
				var mobile = $(this).attr('tel');
				var userid = $(this).attr('userid');
				
				$('.tel_a').attr('href',"tel:"+mobile);
				$('.weui-dialog__bd #photo').attr('src',src);
				$('.weui-dialog__bd span').html('姓名:'+name);
				//$('.open_chat').attr('userid',userid);
				$('.unread_div').show();
			});
			//隐藏提示弹窗操作
			$('.unread_div_yes').bind('click',function(){
				$('.unread_div').hide();
			});
			$('.unread_div_yes1').bind('click',function(){
				$('.unread_div1').hide();
			});
			
//			//发起临时会话
//			$('.open_chat').bind('click',function(){
//				userid = $(this).attr('userid');
//				chat(userid);
//			});
		});

		/** 获取成员大头像 */
		function getBigImage(src){
			var regex = /\/64$/;
			src = src.replace(regex,'/0');
			return src;
		}
	</script>
</head>
<body>	
	 <!--提示信息开始-->
	 <!--未读成员信息弹窗开始-->
	 <div id="dialogs">
	 	<div class="js_dialog unread_div1" id="androidDialog1" style="display: none;">
            <div class="weui-mask"></div>
            <div class="weui-dialog weui-skin_android">
                <div class="weui-dialog__hd" style="text-align: center;"><strong class="weui-dialog__title">成员简要信息</strong></div>
                <div class="weui-dialog__bd" style="text-align: center;">
                    <img id="photo" src="" alt="" style="width:90px;" /><br/>
                    <span style="font-size: 4vw;"></span><br/><br/>
                    <div>
                    	读取消息用时:<span></span> <br/> 读取时间:<span></span>
                    </div>
                    <br/>
                    <a class="tel_a"><img src="__PUBLIC__/News/img/callme.png" width=45 alt="" /></a>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <!--<a class="open_chat" userid=""><img src="__PUBLIC__/News/img/wechat.jpg" width=45 alt="" /></a>-->
                </div>
                <div class="weui-dialog__ft">
                    <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary unread_div_yes1">确定</a>
                </div>
            </div>
        </div>
		<div class="js_dialog unread_div" id="androidDialog1" style="display: none;">
            <div class="weui-mask"></div>
            <div class="weui-dialog weui-skin_android">
                <div class="weui-dialog__hd" style="text-align: center;"><strong class="weui-dialog__title">成员简要信息</strong></div>
                <div class="weui-dialog__bd" style="text-align: center;">
                    <img id="photo" src="" alt="" style="width:90px;" /><br/>
                    <span style="font-size: 4vw;"></span><br/><br/>
                    <a class="tel_a"><img src="__PUBLIC__/News/img/callme.png" width=45 alt="" /></a>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <!--<a class="open_chat" userid=""><img src="__PUBLIC__/News/img/wechat.jpg" width=45 alt="" /></a>-->
                </div>
                <div class="weui-dialog__ft">
                    <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary unread_div_yes">确定</a>
                </div>
            </div>
        </div>
     </div>
	 <!--未读成员信息弹窗结束-->
	 
		<div id="dialog1" style="display:none;">
		<div class="weui-mask"></div>
			<div class="weui-dialog">
				<div class="weui-dialog__hd"><strong class="weui-dialog__title">操作提示</strong></div>
				<div class="weui-dialog__bd">确定要删除该消息所有记录吗？
				</div>
				<div class="weui-dialog__ft">
				<a href="javascript:;" id="del_no" class="weui-dialog__btn weui-dialog__btn_default">取消</a>
				<a href="javascript:;" id="del_yes" class="weui-dialog__btn weui-dialog__btn_primary">确定</a>
				</div>
			</div>
		</div>
	 <!--提示信息结束-->
	<div class="weui-cells__title">已读消息成员列表如下</div>
        <div class="weui-cells">
        	<?php if(empty($has_read_list)):?>
        		<div style="padding:20px;color:red;font-size: 4vw;text-align: center;">
        			<i class="weui-icon-info-circle">暂无回执信息!</i>
        		</div>
			<?php endif;?>
        	<?php foreach($has_read_list as $k => $v):?>
        		<span id="person">
        		<img class="unread_list_avatar1" readtime="<?php 
        			if(!$v['info']['read_time']){
						echo '无数据';        				
        			}else{
        				echo date('m月d日 H:i:s',$v['info']['read_time']);
        			}
        			?>" readfortime="<?php echo $v['info']['read_for_time']?>" src="<?php echo $v['avatar']?>" userid="<?php echo $v['userid'];?>" tel="<?php echo $v['mobile']?>" uname="<?php echo $v['name'];?>" alt="" style="width:35px;height:35px;">
        			<?php echo $v['name']?>
        	    </span>
        	<?php endforeach;?>
        </div>
	</div>
	<div class="weui-cells__title">未读消息成员列表如下</div>
        <div class="weui-cells">
        	<?php if(empty($unread_list)):?>
        		<div style="padding:20px;color:red;font-size: 4vw;text-align: center;">
        			<i class="weui-icon-success">推送成员已全部阅读！</i>
        		</div>
			<?php endif;?>
			<?php foreach($unread_list as $k => $v):?>
        		<span id="person">
        		<img class="unread_list_avatar" userid="<?php echo $v['userid'];?>" src="<?php echo $v['avatar']?>" tel="<?php echo $v['mobile']?>" uname="<?php echo $v['name'];?>" alt="" style="width:35px;height:35px;">
        		<?php echo $v['name']?>
        	    </span>
        	<?php endforeach;?>
        </div>
	</div>
	<div class="weui-cells__title">以下成员读取消息时间小于2秒</div>
        <div class="weui-cells">
        	<?php if(empty($user_short_time_list)):?>
        		<div style="padding:20px;color:red;font-size: 4vw;text-align: center;">
        			<i class="weui-icon-success">无符合条件成员！</i>
        		</div>
			<?php endif;?>
			<?php foreach($user_short_time_list as $k => $v):?>
        		<span id="person">
        		<img class="unread_list_avatar1" readtime="<?php 
        			if(!$v['info']['read_time']){
						echo '无数据';        				
        			}else{
        				echo date('m月d日 H:i:s',$v['info']['read_time']);
        			}
        			?>" readfortime="<?php echo $v['info']['read_for_time']?>" src="<?php echo $v['avatar']?>" userid="<?php echo $v['userid'];?>" tel="<?php echo $v['mobile']?>" uname="<?php echo $v['name'];?>" alt="" style="width:35px;height:35px;">
        			<?php echo $v['name']?>
        	    </span>
        	<?php endforeach;?>
        </div>
	</div>
	
	<div class="weui-cells__title">回执数据统计</div>
        <div class="weui-cells" style="padding:15px;font-size: 4vw;color:gray;">
        	目标接收成员总数: {$count_total} 人<br/>
        	已回执成员总数: {$count_has_read} 人<br/>
        	回执率: 已读量/发送量
        	<div class="weui-progress">
	            <div class="weui-progress__bar">
	                <div class="weui-progress__inner-bar js_progress" style="width: {$count_avg}%;"></div>
	            </div>
	                &nbsp;{$count_avg}%
       		</div>
        </div>
        <div style="text-align: center; font-size: 3vw;margin-top:10px;">
        	<span style="color:red;">小提示1:</span>点击成员头像，即可与其打电话!
        	<br/>
        	<span style="color:red;">小提示2:</span>点击已读成员头像，可查看成员阅读消息时间以及阅读用时!
        </div>
	</div>
	
    <br/>
    <div class="page__bd page__bd_spacing">
    	<a id="del_single" href="javascript:;" class="weui-btn weui-btn_warn">删除该消息</a>
    	<a id="msg_close" href="javascript:;" class="weui-btn weui-btn_plain-primary">返回上一级</a>
    </div>
    <div class="weui-footer" style="margin-top:3%;">
        <p class="weui-footer__links">
            <a href="javascript:void(0);" class="weui-footer__link">中国航天 | 神舟软件</a>
        </p>
        <p class="weui-footer__text">Copyright &copy; 2003-2017</p>
    </div>
</body>
</html>